package com.wyb.mapper;

import com.wyb.pojo.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 * 用户表 Mapper 接口
 * </p>
 *
 * @author wyb
 * @since 2022-10-10
 */
@Mapper
public interface UserMapper extends BaseMapper<User> {

    @Select("select id from sys_user where user_name = #{userName} and password = #{password}")
    Long selectId(User user);

    @Select("select count(1) from sys_user where user_name = #{userName}")
    int selectByUserName(String userName);

    @Update("update sys_user set avatar = #{avatar} where id = #{id}")
    int updateAvatar(@Param("id") int id, @Param("avatar")String avatar);
}
